home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK2.toast / Development Kits (Disc 2) / QuickDraw GX / Programming Stuff / Sample Code / Typography Samples / Basic Layout Sample ƒ / QDGX shell.h < prev   
Encoding:
C/C++ Source or Header  |  1995-04-10  |  4.0 KB  |  151 lines  |  [TEXT/KAHL]

  1. /****************************************************************************/
  2. /*                                                                            */
  3. /*    interfaces for a simple, MULTI-window graphics shell                    */
  4. /*                                                                            */
  5. /*    ©1990 - 1994  Apple Computer, Inc.                                        */
  6. /*    All rights reserved.                                                    */
  7. /*                                                                            */
  8. /****************************************************************************/
  9.  
  10. #include <Desk.h>
  11. #include <Events.h>
  12. #include <Fonts.h>
  13. #include <Windows.h>
  14. #include <Memory.h>
  15. #include <ToolUtils.h>
  16. #include <Menus.h>
  17. #include <Resources.h>
  18. #include <Quickdraw.h>
  19. #include <GestaltEqu.h>
  20. #include <CodeFragments.h>
  21.  
  22. #include "graphics toolbox.h"
  23. #include "graphics routines.h"
  24. #include "graphics libraries.h"
  25. #include "graphics debugging.h"
  26. #include "graphics macintosh.h"
  27. #include "font library.h"
  28. #include "qd library.h"
  29. #include "PrintingMessages.h"
  30. #include "PrintingManager.h"
  31. #include "layout edit library.h"
  32.  
  33.  
  34.  
  35.  
  36. /**\
  37. |**| ---------------------------------------------------------------------
  38. |**| EXTERN GLOBALS
  39. |**| ---------------------------------------------------------------------
  40. \**/
  41. // the following are expected to be initialized by the shell:
  42.  
  43. // QuickDraw GX shell.c:
  44.  
  45. extern Boolean        gQuitting;
  46.  
  47. // the following are expected to be initialized by your code:
  48.  
  49. extern Rect         gWindowQDRect;
  50. extern Str255        gWindowTitle;
  51. extern Boolean        gDebugging;
  52. extern Boolean        gGiveMeValidation;
  53. extern long            gGraphicsHeapSize;
  54.  
  55.  
  56.  
  57. /**\
  58. |**| ---------------------------------------------------------------------
  59. |**| PROTOTYPES
  60. |**| ---------------------------------------------------------------------
  61. \**/
  62.  
  63. // QuickDraw GX shell.c:
  64.  
  65. void    main                    (void);
  66. void     InitToolbox                (void);
  67. void    CheckQuickDrawGX        (void);
  68. OSErr    MyPrintingEventOverride    (EventRecord *event, Boolean filterEvent);
  69. void    EventLoop                (void);
  70. Boolean    IsAppWindow                (WindowPtr wind);
  71. void    MyDoEvent                (EventRecord *event);
  72. void    DoMouseDown                (EventRecord *event);
  73.  
  74. // QDGX shell misc.c:
  75.  
  76. void    DoMenuCommand            (long menuResult);
  77. gxJob    GetDocJob                (WindowPtr);
  78. gxShape    GetDocShape                (WindowPtr);
  79. LayoutEditHandle GetDocLEHandle (WindowPtr);
  80. short    MyStrLength                (char *s);
  81.  
  82. // QDGX shell printing.c:
  83.  
  84. void    SetUpEditMenuRec        (gxEditMenuRecord *);
  85. OSErr    DoFormat                (WindowPtr, gxDialogResult    *);
  86. OSErr    DoPrinting                (WindowPtr);
  87. OSErr    DoPrintOne                (WindowPtr);
  88.  
  89. // routines required by your code
  90. void    DoSetup                    (void);
  91. void    DoDraw                    (WindowPtr wind, Boolean updating);
  92. OSErr    DoCreateNew                (void);
  93. void    DoDispose                (WindowPtr wind);
  94. void    DoIdle                    (WindowPtr wind);
  95. void    DoTeardown                (void);
  96. void    DoClick                    (WindowPtr wind, Point p);
  97.  
  98.  
  99.  
  100. /**\
  101. |**| ---------------------------------------------------------------------
  102. |**| ENUMS
  103. |**| ---------------------------------------------------------------------
  104. \**/
  105. enum dlogIDs {rAboutBoxID=128,rNoQuickDrawGXID=129};
  106.  
  107. enum mbarID {rMenuBar=128};
  108.  
  109. enum menus {mApple=128,mFile,mEdit,fontMenuID, nestingMenuID};
  110.  
  111. enum mApplItems {iAbout=1};
  112. enum mFileItems {iNew=1,iOpen,iClose,iSave,iPageSetup=6,iPrint,iPrintOne,iQuit=10};
  113. enum mEditItems {iUndo=1,iCut=3,iCopy,iPaste,iClear};
  114. enum mNestItems { zeroCommand = 1, oneCommand,
  115.                     twoCommand, threeCommand,
  116.                     fourCommand, fiveCommand,
  117.                     sixCommand, sevenCommand,
  118.                     eightCommand, nineCommand,
  119.                     tenCommand, elevenCommand,
  120.                     twelveCommand, thirteenCommand,
  121.                     fourteenCommand, fifteenCommand,
  122.                     dash1Command, nestCommand,
  123.                     unnestCommand };
  124.  
  125.  
  126. /**\
  127. |**| ---------------------------------------------------------------------
  128. |**| STRUCTS
  129. |**| ---------------------------------------------------------------------
  130. \**/
  131. // This is the structure we use to hold our private data for each window.
  132. // We store a handle to one of these beasties in each window's refCon field.
  133.  
  134. typedef struct
  135. {
  136.   gxJob        docJob;            // print job for this document.
  137.   gxShape    docPage;        // page shape description for this document.
  138.   LayoutEditHandle    docLEHandle;    // page shape description for this document.
  139. } T_Doc, *TP_Doc, **TH_Doc;
  140.  
  141.  
  142. typedef struct {
  143.     gxFont fontID;
  144.     gxStyle fontStyle;
  145. } FontMenuData;
  146.  
  147.  
  148.  
  149.  
  150. extern FontMenuData *fontMenuData;
  151.